

package org.come.Frame;

import org.come.Jpanel.GoodsMsgJpanel;
import org.come.Jpanel.LiangHaoPreviewJpanel;
import org.come.until.FormsManagement;
import org.come.until.Music;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class LiangHaoPreviewJframe extends JInternalFrame implements MouseListener {
	private LiangHaoPreviewJpanel liangHaoPreviewJpanel = new LiangHaoPreviewJpanel();//修改物品展示框尺寸
	private int first_x, first_y;// x、y坐标 ChatHistoryJframe

	public static LiangHaoPreviewJframe getLiangHaoPreviewJframe() {
		return (LiangHaoPreviewJframe)FormsManagement.getInternalForm(707).getFrame();
	}

	public LiangHaoPreviewJframe() {
		this.add(this.liangHaoPreviewJpanel);
		this.addMouseListener(this);
		this.setBackground(new Color(0, 0, 0, 0));
		this.addMouseMotionListener(new MouseMotionListener() {
			public void mouseMoved(MouseEvent e) {
			}

			public void mouseDragged(MouseEvent e) {
				if (isVisible()) {
					int x = e.getX() - first_x;
					int y = e.getY() - first_y;
					setBounds(x + getX(), y + getY(), getWidth(), getHeight());
				}
			}
		});
		this.setBorder(BorderFactory.createEmptyBorder());
		((BasicInternalFrameUI)this.getUI()).setNorthPane(null);
		this.setBounds(248, 300, 400, 150);//修改物品展示框尺寸
		this.pack();
		this.setVisible(false);
		this.setDefaultCloseOperation(3);
	}

	public LiangHaoPreviewJpanel getLiangHaoPreviewJpanel() {
		return liangHaoPreviewJpanel;
	}

	public void setLiangHaoPreviewJpanel(LiangHaoPreviewJpanel liangHaoPreviewJpanel) {
		this.liangHaoPreviewJpanel = liangHaoPreviewJpanel;
	}

	public void mouseClicked(MouseEvent e) {
	}

	public void mousePressed(MouseEvent e) {
		Music.addyinxiao("关闭窗口.mp3");
		if (e.isMetaDown()) {
			FormsManagement.HideForm(707);
		} else {
			FormsManagement.Switchinglevel(707);
		}
		this.first_x = e.getX();
		this.first_y = e.getY();
	}

	public void mouseReleased(MouseEvent e) {
	}

	public void mouseEntered(MouseEvent e) {
	}

	public void mouseExited(MouseEvent e) {
	}
	public int getFirst_x() {
		return first_x;
	}

	public void setFirst_x(int first_x) {
		this.first_x = first_x;
	}

	public int getFirst_y() {
		return first_y;
	}

	public void setFirst_y(int first_y) {
		this.first_y = first_y;
	}
}
